export default {
  methods: {
    //封禁|激活用户确认
    //page如果不是列表页需要传参
    handleBanOrRecover(userList, type, page) {
      let title = type == 'ban' ? '封禁' : '激活'
      this.deleteTips(
        async () => {
          this.banOrRecover(userList, type, page)
        },
        `是否${title}此用户?`,
        title,
      )
    },
    //封禁|激活用户
    async banOrRecover(userList, type, page) {
      let del = type == 'ban' ? 2 : 1
      let arr = userList.map((v) => {
        return { id: v.id, del }
      })
      await this.$store.dispatch('banAndRecoveryTbUserBatch', arr)
      if (page) {
        this.$bus.$emit('refreshUserList')
      } else {
        this.getList()
      }
    },
  },
}
